package com.joysuch.wwyt.workflow.entity;


import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

@Data
@Entity
@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Table(name = "WWYT_WORKFLOW_TASK")
@SQLDelete(sql = "update WWYT_WORKFLOW_TASK set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update WWYT_WORKFLOW_TASK set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class WorkFlowTask implements Serializable {
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("主键ID")
    private Long id;

    @ApiModelProperty("任务节点ID")
    private String taskId;

    @ApiModelProperty("任务节点名称")
    private String taskName;

    @ApiModelProperty("任务节点表单数据")
    private String formData;

    @ApiModelProperty("业务流程ID")
    private Long processId;

    @ApiModelProperty("业务流程实例ID")
    private String processInstanceId;

    @ApiModelProperty("节点变量Map")
    private String varMapData;

    @ApiModelProperty("流程状态： 0=未完成， 1=完成")
    private Integer status;

    @ApiModelProperty("指派类型key: 人员，部门，岗位，角色，组件")
    private String assignKey;

    @ApiModelProperty("指派对象值")
    private String assignValue;

    @ApiModelProperty("APP 任务状态：已接收，等待整改，已上传，等待验收")
    private String appStatus;

    @ApiModelProperty("对象Id")
    private String objectId;

    @ApiModelProperty("类型Id")
    private Long typeId;

    @ApiModelProperty("父数据id")
    private Long parentId = 0L;
    @ApiModelProperty("审批传参")
    private Integer param;

    @ApiModelProperty("编号")
    private String code;

    @ApiModelProperty("业务流程名称")
    @Transient
    private String bizName;

    @ApiModelProperty("模块名称")
    private String refSource;
    @ApiModelProperty("模块数据id--eg:隐患排查记录id")
    private Long refId;
    @ApiModelProperty("模块详情数据id--eg:隐患排查记录详情数据id")
    private Long refDetailId;
    @ApiModelProperty("从formData中提取state")
    private String state;

    @ApiModelProperty("异常状态")
    private String exceptionStatus;

    @ApiModelProperty("上个节点名称")
    private String preTaskName;

    @ApiModelProperty("权限类型")
    private String authType;

    @ApiModelProperty("权限值")
    private String authValue;


    @org.springframework.data.annotation.CreatedBy
    @ApiModelProperty("创建人")
    private Long createBy;

    @org.springframework.data.annotation.CreatedDate
    @ApiModelProperty("创建时间")
    private Date createTime;

    @org.springframework.data.annotation.LastModifiedBy
    @ApiModelProperty("更新人")
    private Long updateBy;

    @org.springframework.data.annotation.LastModifiedDate
    @ApiModelProperty("更新时间")
    private Date updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;

    @ApiModelProperty("任务备注")
    private String comments;

    @ApiModelProperty("统计同步状态")
    private int statisticSyncStatus;

    @ApiModelProperty(value = "报警级别名称:蓝-黄-橙-红")
    private String levelName;

    @ApiModelProperty(value = "推送时间")
    private java.time.LocalDateTime pushTime;
}
